package com.smartleanx.module.hrm.dal.mysql.memorandum;

import java.time.LocalDate;
import java.util.*;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.smartleanx.framework.common.pojo.PageResult;
import com.smartleanx.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.smartleanx.framework.mybatis.core.mapper.BaseMapperX;
import com.smartleanx.framework.security.core.util.SecurityFrameworkUtils;
import com.smartleanx.module.hrm.dal.dataobject.memorandum.MemorandumDO;
import org.apache.ibatis.annotations.Mapper;
import com.smartleanx.module.hrm.controller.admin.memorandum.vo.*;

/**
 * 备忘录 Mapper
 *
 * @author 精益大师
 */
@Mapper
public interface MemorandumMapper extends BaseMapperX<MemorandumDO> {

    default List<MemorandumDO> getMemorandumListByCreator(LocalDate localDate){
        return selectList(new LambdaQueryWrapper<MemorandumDO>()
                .eq(MemorandumDO::getCreator, SecurityFrameworkUtils.getLoginUserId())
                .between(MemorandumDO::getMemosDate, localDate.plusMonths(-1), localDate.plusMonths(1)));
    }

}
